import request from './request';
import type { CommonSenseAccumulation, ApiResponse } from '@/types/accumulation';

// 获取常识积累列表
export function getCommonSenseAccumulations() {
  return request({
    url: '/api/common-sense-accumulation/list',
    method: 'get',
  });
}

// 新增常识积累
export function addCommonSenseAccumulation(data: CommonSenseAccumulation) {
  return request({
    url: '/api/common-sense-accumulation/add',
    method: 'post',
    data
  });
}

// 更新常识积累
export function updateCommonSenseAccumulation(data: CommonSenseAccumulation) {
  return request({
    url: '/api/common-sense-accumulation/update',
    method: 'put',
    data
  });
}

// 删除常识积累
export function deleteCommonSenseAccumulation(id: number) {
  return request({
    url: `/api/common-sense-accumulation/delete/${id}`,
    method: 'delete'
  });
}

// 批量删除常识积累
export function batchDeleteCommonSenseAccumulations(ids: number[]) {
  return request({
    url: '/api/common-sense-accumulation/delete/batch',
    method: 'delete',
    data: ids
  });
}

// 根据ID获取常识积累详情
export function getCommonSenseAccumulationById(id: number) {
  return request({
    url: `/api/common-sense-accumulation/${id}`,
    method: 'get'
  });
}